home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / DOCZ16.ZIP;1 / DOCZ.LIF / CP_R.SH < prev    next >
Encoding:
Text File  |  1994-04-24  |  1.2 KB  |  54 lines

  1. first=${no-yes}
  2. if test $first = yes
  3. then
  4.     prog=`echo $0 | grep "^/"` ; export prog
  5.     test $prog || prog="`pwd`/$0" ;export prog
  6.     source=`echo $1 | grep "^/"` ;export source
  7.     test $source || source="`pwd`/$1" ;export source
  8.     dest=`echo $2 | grep "^/"` ; export dest
  9.     test $dest || dest="`pwd`/$2" ;export dest
  10.  
  11.     no=no ; export no
  12. fi
  13. test -d $dest || mkdir $dest
  14. cd $source
  15. pwd
  16. for i in *
  17. do
  18.     if (test -f "$i")
  19.     then
  20.         cp $i $dest
  21.     fi
  22. done
  23. for x in *
  24. do
  25.     if (test -d "$x")
  26.     then
  27.         (dest="${dest}/$x";export dest;source="${source}/$x";export source;$prog)
  28.     fi
  29. done
  30. if (false)
  31. then
  32. #******************************* DOCZ Header ********************************
  33. .MODULE            cp_r
  34. .LIBRARY         util
  35. .TYPE             command file
  36. .APPLICATION    file
  37. .SYSTEM            unix
  38. .AUTHOR            Roger Wood
  39. .LANGUAGE        Bourne Shell
  40. .DESCRIPTION
  41.     Recursive copy of directories and sub directories.
  42. .ARGUMENTS
  43.     cp_r <source_dir> <target_dir>
  44. .NARRATIVE
  45.     The shell cp_r will take the contents of one directory (including sub-
  46.     directories) and copy them to a target directory.    The target directory
  47.     need not exist before hand.
  48. .RETURNS
  49.   nothing
  50. .ENDOC    END DOCUMENTATION
  51. #****************************************************************************
  52. fi
  53.  
  54.